﻿@Html.DevExpress().RoundPanel(
panelSettings =>
{
    panelSettings.Name = "rpFeatures";
    panelSettings.HeaderText = "["+@ViewBag.PageTitle+"]-下级单位编辑";
    panelSettings.ShowHeader = true;
    panelSettings.View = DevExpress.Web.ASPxRoundPanel.View.Standard;
    panelSettings.ControlStyle.BackColor = Color.White;
    //panelSettings.Width = 315;
    panelSettings.SetContent(() =>
    {
        ViewContext.Writer.Write(
                        
            @Html.DevExpress().GridView(
            settings =>
            {
                settings.Name = "gridView";
                settings.InitDefaultPagerGridViewSettings();
                //settings.SettingsPager.Visible = false;
                settings.SettingsPager.Mode = GridViewPagerMode.ShowAllRecords;
                settings.EnableAlternatingRowColor();
                settings.CallbackRouteValues = new { Controller = "System", Action = "DeptChildPartialView" };

                settings.KeyFieldName = "deptcode";
                settings.Columns.Add("deptname", "单位名称");
                settings.AddYesNoColumn("use_flag", "是否启用");
                settings.Width = Unit.Pixel(1200);
                settings.Columns.Add(col =>
                {
                    col.CellStyle.Paddings.Padding = 1;
                    col.CellStyle.Paddings.PaddingLeft = 5;
                    col.Caption = "";
                    col.Width = 160;
                    col.CellStyle.HorizontalAlign = HorizontalAlign.Center;

                    col.SetDataItemTemplateContent(c =>
                    {
                        string key = DataBinder.Eval(c.DataItem, "deptcode").ToString();
                                    
                        ViewContext.Writer.Write(
                            Html.ActionLink("[编辑]", "", null, new { href = "javascript:edit('" + key + "');" })
                            +"&nbsp;"+
                            Html.ActionLink("[删除]", "DeleteDept", new { id = key }, new { onclick = "return confirm('是否要删除选定的单位?')" })
                
                        );
                    }
                    );
                });
    
            }).Bind(Model).GetHtml()
            );
    });
}).GetHtml()
